# -*- python -*-

from library import library

class BaseAI:
    """@brief A basic AI interface.

    This class implements most the code an AI would need to interface with the lower-level game code.
    AIs should extend this class to get a lot of builer-plate code out of the way
    The provided AI class does just that.
    """
    initialized = False
    iteration = 0
% for model in models:
    ${lowercase(model.name)}s = []
% endfor

    def startTurn(self):
% for model in models:
        from GameObject import ${model.name}
% endfor

% for model in models:
        BaseAI.${lowercase(model.name)}s = [${model.name}(library.get${model.name}(i)) for i in xrange(library.get${model.name}Count())]
% endfor

        if not self.initialized:
            self.initialized = True
            self.init()
        BaseAI.iteration += 1;
        return self.run()
    
% for datum in globals:
    @staticmethod
    def ${datum.name}():
%   if datum.doc:
        """${datum.doc}
        """
%   endif
        return library.get${capitalize(datum.name)}()

% endfor
